﻿using AnChao.WPF.Controls.Prism.Core;
using Prism.Commands;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Data;
using System.Windows.Input;

namespace AnChao.WPF.Controls.Prism.ViewModels
{
    public class GetMonthDayViewModel : BindableBase
    {
        IApplicationCommands _applicationCommands;

        public GetMonthDayViewModel(IApplicationCommands applicationCommands)
        {
            _applicationCommands = applicationCommands;

            _applicationCommands.GetCurrentAllTimeCommand.RegisterCommand(GetMonthCommand);
        }

        private DelegateCommand _getMonthCommand;
        public DelegateCommand GetMonthCommand =>
            _getMonthCommand ?? (_getMonthCommand = new DelegateCommand(ExcuteCommandName));

        private string _currentMonthDay;
        public string CurrentMonthDay
        {
            get 
            {
                return _currentMonthDay;
            }
            set 
            {
                SetProperty(ref _currentMonthDay, value);
            }
        }

        private string _title;
        public string Title
        {
            get
            {
                return _title;
            }
            set
            {
                SetProperty(ref _title, value);
            }
        }

        private void ExcuteCommandName()
        {
            this.CurrentMonthDay = DateTime.Now.ToString("MM:dd");
        }
    }
}
